#include "RBTree.h"
#include <vector>
using namespace std;

void test1()
{
	RBTree<int, int> t;
	int arr[] = { 16, 3, 7, 11, 9, 26, 18, 14, 15 };
	for (auto e : arr)
	{
		t.insert(make_pair(e, e));
	}
	t.inorder();
	cout << t.IsRBTree() << endl;
	for (auto e : arr)
	{
		t.erase(e);
	}
	cout << t.IsRBTree() << endl;
}

void test2()
{
	vector<int> v;
	RBTree<int, int> t;
	int n = 1000000;
	v.reserve(n);
	srand(time(0));
	for (int i = 0; i < n; i++)
	{
		int tmp = rand();
		v.push_back(tmp);
		t.insert(make_pair(tmp, tmp));
	}
	cout << t.IsRBTree() << endl;
	for (int i = 100; i < n / 2; i++)
	{
		t.erase(v[i]);
	}
	cout << t.IsRBTree() << endl;

}
int main()
{
	test2();
	return 0;
}